package com.example.lemis.web.controller;

import com.example.lemis.model.dto.BannerDTO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.lemis.common.JsonResponse;
import com.example.lemis.service.IFkBannerDivisionService;
import com.example.lemis.model.domain.FkBannerDivision;


/**
 *
 *  前端控制器
 *
 *
 * @author lxp
 * @since 2025-06-24
 * @version v1.0
 */
@RestController
@RequestMapping("/api/fkBannerDivision")
public class FkBannerDivisionController {

    private final Logger logger = LoggerFactory.getLogger( FkBannerDivisionController.class );

    @Autowired
    private IFkBannerDivisionService fkBannerDivisionService;


    /**
    * 描述：根据Id 查询
    *
    */
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public JsonResponse<FkBannerDivision> getById(@PathVariable("id") Long id)throws Exception {
        FkBannerDivision fkBannerDivision = fkBannerDivisionService.getById(id);
        return JsonResponse.success(fkBannerDivision);
    }

    @PostMapping("/change")
    public JsonResponse<?> update_division_banner(@RequestBody FkBannerDivision fkBannerDivision) throws Exception {
        System.out.println(fkBannerDivision);
        FkBannerDivision fk = fkBannerDivisionService.update_division_banner(fkBannerDivision);
        return JsonResponse.success(fk);
    }

    @GetMapping("search")
    public JsonResponse<?> search_division_banner(BannerDTO bannerDTO) throws Exception {
        BannerDTO bannerDTO1 = fkBannerDivisionService.search_division_banner(bannerDTO);
        return JsonResponse.success(bannerDTO1);
    }
}

